package com.mall.service.mallLogs.task;

import com.mall.service.mallLogs.service.CountTimeoutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 定时统计接口超时次数
 */
@Component
public class CountTimeoutTask {

    @Autowired
    private CountTimeoutService countTimeoutService;

    @Scheduled(cron = "0/20 * * * * ?")
    public void analysisTask() {
        //业务逻辑
        String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
        System.out.println("开始统计："+time);
        //调logService完成日志统计
        countTimeoutService.countTimeout();
        System.out.println("结束统计");
    }
}
